package com.wifi.user.servlet;

import com.alibaba.fastjson.JSON;
import com.wifi.user.service.UserService;
import com.wifi.user.service.UserServiceImpl;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;

@WebServlet("/user/mana")
public class ManaServlet extends HttpServlet {
    UserService userService=new UserServiceImpl();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.getRequestDispatcher("/WEB-INF/user/mana.jsp").forward(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
List<Object> l=userService.queryAll();
response.getWriter().write(JSON.toJSONString(l));
    }
}
